package org.example.book.normal.state.order;

import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@Data
public class DeprecatedOrderContext {

    private DeprecatedOrderState currentState;

    @Autowired
    private DeprecatedCreateOrder createOrder;

    public DeprecateOrder createOrder(String orderId, String productId) {
        this.currentState = this.createOrder;
        DeprecateOrder order = currentState.createOrder(orderId, productId, this);
        return order;
    }

    public DeprecateOrder sendOrder(String orderId) {
        DeprecateOrder deprecateOrder = currentState.sendOrder(orderId, this);
        return deprecateOrder;
    }

    public DeprecateOrder receiveOrder(String orderId) {
        DeprecateOrder deprecateOrder = currentState.receiveOrder(orderId, this);
        return deprecateOrder;
    }

    public DeprecateOrder payOrder(String orderId) {
        DeprecateOrder deprecateOrder = currentState.payOrder(orderId, this);
        return deprecateOrder;
    }
}
